﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Application.Controls
{
    using System.Windows.Forms;

    /// <summary>Provides additional methods for the <see cref="TreeNode"/> class.</summary>
    /// <threadsafety static="true" instance="false"/>
    public static class TreeNodeHelper
    {
        /// <summary>Sets the appearance of a treenode.</summary>
        public static void SetAppearance(this TreeNode node, bool bold, int imageIndex, int selectedImageIndex)
        {
            var tvitem = new NativeMethods.TVITEM(node.Handle, bold, imageIndex, selectedImageIndex);
            NativeMethods.SendMessage(node.TreeView.Handle, NativeMethods.TVM_SETITEMW.MSG, 0, ref tvitem);
        }
    }
}
